#ifndef PARSED_FILE_LIST_PARSER
#define PARSED_FILE_LIST_PARSER

#include <xercesc/sax2/SAX2XMLReader.hpp>
#include <xercesc/sax2/XMLReaderFactory.hpp>
#include <xercesc/sax2/DefaultHandler.hpp>

#include <iostream>
#include <string>
#include <list>

namespace Dictionary
{
	class ParsedFileListParser : public XERCES_CPP_NAMESPACE_QUALIFIER DefaultHandler {
	 public:

		 typedef std::list<std::string> parsed_files_t;

		 ParsedFileListParser(const std::string &file_name) : filelist_name(file_name) {}

		 virtual void startElement(const XMLCh* const uri,const XMLCh* const localname,const XMLCh* const qname,const XERCES_CPP_NAMESPACE_QUALIFIER Attributes& attrs);
		 virtual void fatalError(const XERCES_CPP_NAMESPACE_QUALIFIER SAXParseException& exception);
		 virtual void endElement(const XMLCh *const uri,const XMLCh *const localname,const XMLCh *const qname);
		 virtual void characters(const XMLCh *const chars,const unsigned int	length);

		 void set_file_list_name(const std::string file_name) { filelist_name = file_name; }

     parsed_files_t* parse();

	 private:
		 void add_file(char *);

		 parsed_files_t * parsed_files;
		 std::string filelist_name;

		 bool is_file_element;
	};

}

#endif